#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date    : 2016-11-17 01:03:11
# @Author  : guoben (guoben.ly@qq.com)
# @Link    : https://git.oschina.net/guoben

from bs4 import BeautifulSoup
import urllib2

try:
	html = urllib2.urlopen('http://www.baidu.com')
except IOError,e:
	print e
else:	
	print html
	bsObj = BeautifulSoup(html)
	nameList = bsObj.findAll("span",{"class":"green"})
	for name in nameList:
		print name.get_text()

